<template>
	<view class="news">
		<view class="title">{{detail.title}}</view>
		<view class="time">{{detail.create_time}}</view>
		<view class="content">
			<image :src="detail.img_url"></image>
			<text>{{detail.conten}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				uid: '',
				detail: {},
				number: 1,
				totalPrice: 0
			};
		},
		onLoad(options) {
			this.uid = options.id;
			this.getDetail()
		},
		methods:{
			getDetail(){
				let self = this;
				uni.showLoading({title: '加载中',mask: true,duration: 5000});
				this.config.post('/api/news/findById', {
					id: this.uid,
				}).then(res=>{
					uni.hideLoading();
					if(res.data.code==='0'){
						self.detail = res.data.news;
					}else{
						uni.showToast({title: self.config.handleError(res.data),icon: 'none'});
					}
				})
			},
		}
	}
</script>

<style scoped lang="less">
	.news{
		width: 100%;
		background-color: #fff;
		text-align: center;
		.title{
			font-size: 40upx;
			font-weight: bold;
			margin-top: 20upx;
		}
		.time{
			font-size: 25upx;
			color: #808080;
		}
		.content{
			width: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-top: 30upx;
			font-size: 30upx;
		}
	}
</style>
